package com.songlanyun.modules.distributionconfig.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.math.BigDecimal;
import java.io.Serializable;
import java.util.Date;

import com.songlanyun.common.drive.RootEntity;
import com.songlanyun.common.enums.GoodsConstant;
import lombok.Data;

import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotNull;

/**
 * 商家分销设置，用来管控店铺分销的开启与关闭，分销佣金算法和算法数据
 * 
 * @author lubo
 * @email sunlightcs@gmail.com
 * @date 2020-12-22 11:43:24
 */
@Data
@TableName("yxt_distribution_shop_config")
public class DistributionShopConfig extends RootEntity<Long,DistributionShopConfig> implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 
	 */
	@TableId
	private Long id;
	/**
	 * 商家id
	 */
	@NotNull(message = "商家id必须给")
	private Long shopId;
	/**
	 * 是否开启分佣
	 */
	private Boolean open;
	/**
	 *
	 */
	@TableField(fill = FieldFill.INSERT)
	private Date createTime;
	/**
	 *
	 */
	@TableField(fill = FieldFill.INSERT_UPDATE)
	private Date updateTime;
	/**
	 * 计算模式，0固定价格，1固定比例
	 */
	private GoodsConstant.ComputeMode computeMode;
	/**
	 * 一级固定价格
	 */
	@DecimalMin(value = "0",message = "一级固定价格最小值是0")
	@DecimalMax(value = "99999999",message = "一级固定价格最大值是99999999")
	private BigDecimal firstLevelPrice;
	/**
	 * 二级固定价格
	 */
	@DecimalMin(value = "0",message = "二级固定价格最小值是0")
	@DecimalMax(value = "99999999",message = "二级固定价格最大值是99999999")
	private BigDecimal secondLevelPrice;
	/**
	 * 一级固定比例
	 */
	@DecimalMin(value = "0",message = "一级固定比例最小值是0%")
	@DecimalMax(value = "50",message = "一级固定比例最大值是50%")
	private BigDecimal firstLevelRatio;
	/**
	 * 二级固定比例
	 */
	@DecimalMin(value = "0",message = "二级固定比例最小值是0%")
	@DecimalMax(value = "50",message = "二级固定比例最大值是50%")
	private BigDecimal secondLevelRatio;

	@Override
	public Long getIdentity() {
		return getId();
	}
}
